package csel.controller.commands;

import csel.model.*;
import csel.view.*;

public class UnequipCommand implements GameCommand
{
	private EquippableItem[] items;
	private Entity entity;

	//creates a new Unequip command
	public UnequipCommand(Model model, StatusViewport statusViewport)
	{
		this.entity = model.getPlayerEntity();
		this.items = statusViewport.getSelectedEquipmentItems();
	}

	// iterates through the items ad unequips them all
	public void execute()
	{
		if (items != null)
		{
			for (EquippableItem i : items)
			{
				entity.unequipItem(i);
			}
		}
		if(Model.infoMode)System.out.println("[MODEL] the Unequip command has been called");
	}
	
	public String toString()
	{
		return this.getClass().getSimpleName();
	}
}